package Problem;

public class Problem2 {
    public static void main(String[] args) {
        //使用了无参构造器
        C c = new C();
        System.out.println(c.getX());
    }

}
class C {
    private int x;
    public C(int x) {
        //此处 this 的引用场景
        this.x = x;
    }
    //可以用无参构造器来直接调用兄弟构造器
    public C() {
        this(2);
    }
    public int getX(){
        return x;
    }
}
